home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 426-450 / disk_450 / uucp / src / getty / icept.asm < prev    next >
Assembly Source File  |  1992-05-06  |  2KB  |  126 lines

  1.  
  2.         ;   ICEPT.ASM
  3.         ;
  4.         ;   Intercept OpenDevice() for serial.device and force
  5.         ;   SERF_SHARED for the first openner, EXLUSIVE for
  6.         ;   other openners (required because I had to remove the
  7.         ;   serial port refcnt checking from uucico to support
  8.         ;   multi-serial ports)
  9.         ;
  10.         ;   A1 holds IOExtSer request ptr.  D0-D1/A0-A1 are NOT
  11.         ;   scratch.
  12.         ;
  13.         ;   You CANNOT use A4 relative addressing since this routine
  14.         ;   is called from a different context.
  15.         ;
  16.         ;   Various hacks have been added (checking the unit number
  17.         ;   against $FFFF) because, apparently, the A2232 serial
  18.         ;   device re-vectors through its opendevice vector for
  19.         ;   some ungodly reason.
  20.  
  21.         include "exec/types.i"
  22.         include "devices/serial.i"
  23.  
  24.         section text,CODE
  25.  
  26.         xdef    _AsmOpenIntercept
  27.         xdef    _AsmCloseIntercept
  28.  
  29.         xref    _OldOpenVector
  30.         xref    _OldCloseVector
  31.         ;xref     _OldBeginIOVector
  32.         xref    _DeviceUnit
  33.         xref    _DeviceName
  34.         xref    _RefCnt
  35.         xref    _UnitPtr        ; check unit on close
  36.         xref    _strcmp
  37.  
  38.         ;   OpenDevice
  39.         ;
  40.         ;   A0 = devName
  41.         ;   D0 = unitNumber
  42.         ;   A1 = iORequest
  43.         ;   D1 = flags
  44.  
  45. _AsmOpenIntercept:
  46.         cmp.l    _DeviceUnit,D0
  47.         beq    aovalid
  48.         move.l    _OldOpenVector,-(sp)
  49.         rts
  50.  
  51. aovalid
  52.         tst.l    _RefCnt
  53.         beq    oivalid10
  54.         bmi    oivalid10
  55.         moveq.l #1,D0        ; return error
  56.         move.b    D0,31(A1)       ; store in io_Error
  57.         clr.l    20(A1)          ; clear io_Device
  58.         rts
  59.  
  60. oivalid10
  61.         or.b    #SERF_SHARED,IO_SERFLAGS(A1)
  62.         move.l    A1,-(sp)
  63.         pea    oirts(pc)
  64.         move.l    _OldOpenVector,-(sp)
  65.         rts
  66. oirts
  67.         move.l    (sp)+,A1
  68.         tst.b    31(A1)          ; error code
  69.         bne    oifailed
  70.         move.l    24(A1),_UnitPtr
  71.         addq.l    #1,_RefCnt
  72. oifailed
  73.         rts
  74.  
  75. _AsmCloseIntercept:
  76.         move.l    A0,-(sp)
  77.         move.l    24(A1),A0
  78.         cmp.l    _UnitPtr,A0
  79.         bne    ci10
  80.         subq.l    #1,_RefCnt
  81. ci10
  82.         move.l    (sp)+,A0
  83.         move.l    _OldCloseVector,-(sp)
  84.         rts
  85.  
  86.         ;   A2232 serial.device fix
  87.  
  88. ;         xdef     _A2232BeginIOFix
  89. ;
  90. ;_A2232BeginIOFix
  91. ;        movem.l A2/A5-A6,-(sp)
  92. ;        move.l    A1,-(sp)
  93. ;        move.l    $18(A1),A5
  94. ;        movea.l 8(A5),A6
  95. ;        move.b    #5,8(A1)
  96. ;        move.l    $1C(A1),D0
  97. ;        andi.w    #$100,D0
  98. ;        move.w    D0,$1E(A1)
  99. ;        clr.w    D0
  100. ;        swap    D0
  101. ;        cmpi.w    #$B,D0
  102. ;        bls    sk10
  103. ;        moveq.l #0,D0
  104. ;sk10         lsl.w     #2,D0
  105. ;        move.l    D0,-(sp)
  106. ;        lea    $40(A5),A0
  107. ;        jsr    -$234(A6)
  108. ;        move.l    (sp)+,A0
  109. ;        add.l    _OldBeginIOVector,A0
  110. ;        add.l    #$50,A0
  111. ;        move.l    (A0),A0
  112. ;        jsr    (A0)
  113. ;        move.l    D0,-(sp)
  114. ;        lea    $40(A5),A0
  115. ;        jsr    -$23A(A6)
  116. ;        move.l    (sp)+,D0
  117. ;        move.l    (sp)+,A1
  118. ;        andi.b    #$41,D0
  119. ;        bne    sk20
  120. ;        jsr    -$17A(A6)
  121. ;sk20         movem.l (sp)+,A2/A5-A6
  122. ;        rts
  123.  
  124.         END
  125.  
  126.